<?php
$db_host = '127.0.0.1';
$db_name = 'sgmec';
$db_user = 'root';
$db_pass = '';

$fichero = $db_name.'_'.date("YmdHis").'.sql';
$DirBaseDump = "C:\\xampp\\mysql\\bin\\mysqldump.exe";
$executa="$DirBaseDump --host=$db_host --user=$db_user --password=$db_pass -R -c --add-drop-table $db_name> $fichero";
system($executa);

header("Content-Disposition: attachment; filename=".$fichero.""); 
header("Content-type: application/force-download");
@readfile($fichero);
unlink($fichero);
?>